package com.ggkt.datatype;

/**
 * @author ggkt
 * 小数保留两位小数可以使用float类型，保留两位小数用*100再除以100来实现。
 */
public class DoubleTest {
    public static void main(String[] args) {
        Integer a=1;
        Integer b=12;
        float c=(float)(100*a/b)/100;
        System.out.println(c);
        DoubleTest dt = new DoubleTest();
        dt.setSalary(2000000.333332555544f);
        dt.setMoney(100000.1234567890);
        dt.setPeople(2000000000);
        dt.toString();
    }
    private float salary;
    private double money;
    private long people;

    public long getPeople() {
        return people;
    }

    public void setPeople(long people) {
        this.people = people;
    }

    public float getSalary() {
        return salary;
    }

    public void setSalary(float salary) {
        this.salary = salary;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    @Override
    public String toString(){
        System.out.println("money:"+this.money+"\nsalary:"+this.salary+"\npeople:"+this.people);
        return null;
    }

}
